// pages/user/user.js
const app = getApp();
Page({
  data: {
    isShowUserName: false,
    userInfo: null,
  },
  onShow(options) {
    var user = app.globalData.userInfo;
    if (user && user.nickName) {
      this.setData({
        isShowUserName: true,
        userInfo: user,
      })
    }
  },
  getUserProfile(){
    wx.getUserProfile({
      desc:'用于完善个人信息资料',
      success: (res) => {
        console.log("获取用户信息成功",res)
        let user = res.userInfo
        wx.setStorageSync('user', user)
        this.setData({
          isShowUserName:true,
          userInfo:user,
        })
      },
      fail: res => {
        console.log("获取用户信息失败",res)
      }
    })
  },
  goOrderRecord:function(){
    wx.navigateTo({
      url: '/pages/order-record/order-record',
    })
  },
  goUserinfo:function(){
    wx.navigateTo({
      url: '/pages/user-info/user-info',
    })
  },
  goHelp:function(){
    wx.navigateTo({
      url: '/pages/help/help',
    })
  }
  
})